using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace TimeTableManagement.Entities
{
    public class Tb_Slot
    {
        /// <summary>
        /// 
        /// </summary>
        public Tb_Slot()
        {
            this.Tb_Slot_Room = new List<Tb_Slot_Room>();
            this.Tb_Timetable = new List<Tb_Timetable>();
        }

        public int id { get; set; }
        [Required]
        [Display(Name = "Slot")]
        public string slot { get; set; }
        [Required]
        [Display(Name = "To")]
        public Nullable<int> to { get; set; }
        [Required]
        [Display(Name = "From")]
        public Nullable<int> from { get; set; }
        [Display(Name = "Note")]
        [DataType(DataType.MultilineText)]
        [System.Web.Mvc.AllowHtml]
        public string note { get; set; }
        public virtual ICollection<Tb_Slot_Room> Tb_Slot_Room { get; set; }
        public virtual ICollection<Tb_Timetable> Tb_Timetable { get; set; }

        public static object getFrom(int? nullable)
        {
            string _term = nullable.ToString();
            if (_term.Length == 3) _term = "0" + _term;
            string _r = _term.Substring(0, 2) + ":" + _term.Substring(2, 2);
            return _r;
        }
    }
    public class RegSlot
    {
        int _id;
        String _slot;
        int _prior;
        public int id
        {
            get { return _id; }
            set { _id = value; }
        }
        public String slot
        {
            get { return _slot; }
            set { _slot = value; }
        }
        public int prior
        {
            get { return _prior; }
            set { _prior = value; }
        }
    }
}

